<template>
	<view class="content">
		<u-navbar title="与尔" :is-back="isBack" :background="background"></u-navbar>

		<!-- 		<view class="wrap">
			<u-swiper :height="400" :list="list"></u-swiper>
		</view> -->
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">
			</text>
		</view>

		<u-grid @click="clickGrid" :border="false">

			<u-grid-item :index="1">
				<u-icon name="list" :size="66"></u-icon>
				<view class="grid-text">每日记录</view>
			</u-grid-item>

			<u-grid-item :index="3">
				<u-icon name="home" :size="66"></u-icon>
				<view class="grid-text">添加</view>
			</u-grid-item>

			<u-grid-item :index="4">
				<u-icon name="star" :size="66"></u-icon>
				<view class="grid-text"> 最近事项 </view>
			</u-grid-item>

			<u-grid-item :index="5">
				<u-icon name="file-text" :size="66"></u-icon>
				<view class="grid-text">
					官网文档
				</view>
			</u-grid-item>

			<u-grid-item :index="7">
				<u-icon name="rewind-right" :size="66"></u-icon>
				<view class="grid-text">测试页面</view>
			</u-grid-item>

			<u-grid-item :index="8">
				<u-icon name="shopping-cart" :size="66"></u-icon>
				<view class="grid-text">测试按钮</view>
			</u-grid-item>

		</u-grid>
		<u-toast ref="uToast"></u-toast>
		<u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: {
					backgroundImage: 'linear-gradient(19deg, #21D4FD 0%, #B721FF 100%)'
				},
				isBack: false,
				list: [{
						image: '/static/logo.png',
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
					}
				],
				title: 'Hello'
			}
		},
		onLoad() {
			console.log("1-index - onLoad")
		},
		onShow() {
			console.log("2-index - onShow")
		},
		created() {
			console.log("3-index - created")
		},
		onReady() {
			console.log("4-index - onReady")
		},
		onPullDownRefresh() {
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1000)
		},
		methods: {
			clickGrid(index) {
				console.info("clickGrid ")

				if (index == 5) {
					this.$dy_tool.openURL('http://www.uviewui.com')
				}
				if (index == 1) {
					uni.navigateTo({
						url: '/pages/record/record',
					})
				}
				if (index == 7) {
					uni.navigateTo({
						url: '/pages/test/test',
					})
				}
				if (index == 4) {
					uni.navigateTo({
						url: '/pages/recently/recently',
					})
				}
				if (index == 3) {
					uni.navigateTo({
						url: '/pages/addRecently/addRecently',
					})
				}
				// this.$refs.uToast.show({
				// 	title: `点击了第${index + 1}宫格`,
				// 	type: 'warning'
				// })
			}
		},
		onLoad() {
			console.info("主页加载完成")
		}
	}
</script>

<style lang="scss" scsoped>
	.wrap {
		width: 750rpx;
		margin-top: -50rpx;
		padding: 30rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 40rpx;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 100rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 28rpx;
		color: $u-content-color;
	}

	.button-demo {
		margin-top: 80rpx;
	}

	.link-demo {
		margin-top: 80rpx;
	}
</style>
